﻿
using System.Collections.Generic;

namespace BookTheBook.Data.Model
{
    public class User
    {
        public virtual int Id { get; private set;}
        public virtual string Login { get; set; }
        public virtual IList<RentDetails> RentedBooks { get; set; }
        public virtual IList<Role> Roles { get; set; }

        public User()
        {
            RentedBooks = new List<RentDetails>();
        }

        public virtual void AddRentedBook(RentDetails rentDetails)
        {
            rentDetails.User = this;
            RentedBooks.Add(rentDetails);
        }

        public virtual void AddRole(Role role)
        {
            role.Users.Add(this);
            Roles.Add(role);
        }
    }
}


